var targetType;
var targetId;
var copyNodeId;
var dialogId;

/**
 * 返回
 */
function closeWindow(){
	if (parent != null && parent.$('#' + dialogId) != null) {
		parent.$('#' + dialogId).dialog('close');
	}
}

/**
 * 保存复制到目标用户
 */
function saveCopyToTargetModel(){
	var checkedRows = $("#targetModelTreegrid").datagrid("getChecked");
	var nodeIds = "";
	var nodeNames = "";
	for(var i = 0; i < checkedRows.length; i++){
		nodeIds += checkedRows[i].ID + ",";
		nodeNames += checkedRows[i].ARCHIVE_CLASS_NODE_NAME + ",";
	}
	if (nodeIds != "") {
		nodeIds = nodeIds.substring(0, nodeIds.length - 1);
		nodeNames = nodeNames.substring(0, nodeNames.length - 1);
		$.ajax({
			url : 'platform/UserAuthSetController/saveCopyToTargetModel',
			data : {
				targetType : targetType,
				targetId : targetId,
				copyNodeId : copyNodeId,
				targetNodeIds : nodeIds,
				targetNodeNames : nodeNames
				},
			type : 'post',
			dataType : 'json',
			success : function(result) {
				parent.copyAfter(dialogId, result.flag);
			}
		});
	} else {
		//commonLang.tip.alert替换'提示',commonLang.optip.del.selectNode替换'请选择数据节点！'
		$.messager.alert(commonLang.tip.alert, commonLang.optip.del.selectNode, 'warning');
	}
}